<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 用户优惠券 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\UserCoupons.name", default="fa_user_coupons"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\UserCoupons.poolName"))
 * @DDL(sql="CREATE TABLE `fa_user_coupons` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) DEFAULT NULL COMMENT '用户ID',
  `coupons_id` int(11) DEFAULT NULL COMMENT '优惠券',
  `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单 id',
  `usetime` int(11) DEFAULT NULL COMMENT '使用时间',
  `createtime` int(11) DEFAULT NULL COMMENT '领取时间',
  `end_time` int(11) unsigned DEFAULT NULL COMMENT '到期时间',
  `store_id` int(10) unsigned DEFAULT '0' COMMENT '店铺ID',
  `status` enum('1','2','3') DEFAULT '1' COMMENT '状态:1=待使用,2=已使用,3=已过期',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户优惠券'", decode="")
 *
 * @property int|null $id 
 * @property int|null $userId 用户ID
 * @property int|null $couponsId 优惠券
 * @property int|null $orderId 订单 id
 * @property int|null $usetime 使用时间
 * @property int|null $createtime 领取时间
 * @property int|null $endTime 到期时间
 * @property int|null $storeId 店铺ID
 * @property string|null $status 状态:1=待使用,2=已使用,3=已过期
 */
abstract class UserCouponsBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * id.
     * @Column(name="id", type="int", length=11, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 用户ID.
     * user_id
     * @Column(name="user_id", type="int", length=11, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $userId = NULL;

    /**
     * 获取 userId - 用户ID.
     *
     * @return int|null
     */
    public function getUserId(): ?int
    {
        return $this->userId;
    }

    /**
     * 赋值 userId - 用户ID.
     * @param int|null $userId user_id
     * @return static
     */
    public function setUserId($userId)
    {
        $this->userId = null === $userId ? null : (int)$userId;
        return $this;
    }

    /**
     * 优惠券.
     * coupons_id
     * @Column(name="coupons_id", type="int", length=11, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $couponsId = NULL;

    /**
     * 获取 couponsId - 优惠券.
     *
     * @return int|null
     */
    public function getCouponsId(): ?int
    {
        return $this->couponsId;
    }

    /**
     * 赋值 couponsId - 优惠券.
     * @param int|null $couponsId coupons_id
     * @return static
     */
    public function setCouponsId($couponsId)
    {
        $this->couponsId = null === $couponsId ? null : (int)$couponsId;
        return $this;
    }

    /**
     * 订单 id.
     * order_id
     * @Column(name="order_id", type="int", length=11, accuracy=0, nullable=false, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $orderId = 0;

    /**
     * 获取 orderId - 订单 id.
     *
     * @return int|null
     */
    public function getOrderId(): ?int
    {
        return $this->orderId;
    }

    /**
     * 赋值 orderId - 订单 id.
     * @param int|null $orderId order_id
     * @return static
     */
    public function setOrderId($orderId)
    {
        $this->orderId = null === $orderId ? null : (int)$orderId;
        return $this;
    }

    /**
     * 使用时间.
     * usetime
     * @Column(name="usetime", type="int", length=11, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $usetime = NULL;

    /**
     * 获取 usetime - 使用时间.
     *
     * @return int|null
     */
    public function getUsetime(): ?int
    {
        return $this->usetime;
    }

    /**
     * 赋值 usetime - 使用时间.
     * @param int|null $usetime usetime
     * @return static
     */
    public function setUsetime($usetime)
    {
        $this->usetime = null === $usetime ? null : (int)$usetime;
        return $this;
    }

    /**
     * 领取时间.
     * createtime
     * @Column(name="createtime", type="int", length=11, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $createtime = NULL;

    /**
     * 获取 createtime - 领取时间.
     *
     * @return int|null
     */
    public function getCreatetime(): ?int
    {
        return $this->createtime;
    }

    /**
     * 赋值 createtime - 领取时间.
     * @param int|null $createtime createtime
     * @return static
     */
    public function setCreatetime($createtime)
    {
        $this->createtime = null === $createtime ? null : (int)$createtime;
        return $this;
    }

    /**
     * 到期时间.
     * end_time
     * @Column(name="end_time", type="int", length=11, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $endTime = NULL;

    /**
     * 获取 endTime - 到期时间.
     *
     * @return int|null
     */
    public function getEndTime(): ?int
    {
        return $this->endTime;
    }

    /**
     * 赋值 endTime - 到期时间.
     * @param int|null $endTime end_time
     * @return static
     */
    public function setEndTime($endTime)
    {
        $this->endTime = null === $endTime ? null : (int)$endTime;
        return $this;
    }

    /**
     * 店铺ID.
     * store_id
     * @Column(name="store_id", type="int", length=10, accuracy=0, nullable=true, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $storeId = 0;

    /**
     * 获取 storeId - 店铺ID.
     *
     * @return int|null
     */
    public function getStoreId(): ?int
    {
        return $this->storeId;
    }

    /**
     * 赋值 storeId - 店铺ID.
     * @param int|null $storeId store_id
     * @return static
     */
    public function setStoreId($storeId)
    {
        $this->storeId = null === $storeId ? null : (int)$storeId;
        return $this;
    }

    /**
     * 状态:1=待使用,2=已使用,3=已过期.
     * status
     * @Column(name="status", type="enum", length=0, accuracy=0, nullable=true, default="1", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $status = '1';

    /**
     * 获取 status - 状态:1=待使用,2=已使用,3=已过期.
     *
     * @return string|null
     */
    public function getStatus(): ?string
    {
        return $this->status;
    }

    /**
     * 赋值 status - 状态:1=待使用,2=已使用,3=已过期.
     * @param string|null $status status
     * @return static
     */
    public function setStatus($status)
    {
        $this->status = null === $status ? null : (string)$status;
        return $this;
    }

}
